home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20000217-20000824 / 000046_news@columbia.edu _Fri Feb 25 21:40:44 2000.msg < prev    next >
Internet Message Format  |  2020-01-01  |  5KB

  1. Return-Path: <news@columbia.edu>
  2. Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.59.30])
  3.     by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id VAA29273
  4.     for <kermit.misc@watsun.cc.columbia.edu>; Fri, 25 Feb 2000 21:40:43 -0500 (EST)
  5. Received: (from news@localhost)
  6.     by newsmaster.cc.columbia.edu (8.9.3/8.9.3) id VAA22122
  7.     for kermit.misc@watsun.cc.columbia.edu; Fri, 25 Feb 2000 21:34:10 -0500 (EST)
  8. X-Authentication-Warning: newsmaster.cc.columbia.edu: news set sender to <news> using -f
  9. From: Peter Easthope <peter_easthope@gulfnet.pinc.com>
  10. Subject: Re: Array name passed to macro as argument?
  11. Date: Sat, 26 Feb 2000 01:57:39 GMT
  12. Organization: Deja.com - Before you buy.
  13. Message-ID: <897bui$l35$1@nnrp1.deja.com>
  14. To: kermit.misc@columbia.edu
  15.  
  16. In <891805$ltt$1@newsmaster.cc.columbia.edu> posted at
  17. 2000 Feb 23 18:13:25 GMT Frank da Cruz said,
  18. fdc> OK, here's another way that works in MS-DOS Kermit 3.15, as
  19. fdc> well as in K95 and C-Kermit:
  20. fdc>
  21. fdc>   def arraytest {                ; Define macro
  22. fdc>     local \%x
  23. fdc>     assign \%x \\\%1[1]
  24. fdc>     echo {\%x}
  25. fdc>     assign \%x \\\%1[2]
  26. fdc>     echo {\%x}
  27. fdc>   }
  28. fdc>   declare \&a[10]                 ; Set up array
  29. fdc>   assign \&a[1] one
  30. fdc>   assign \&a[2] two
  31. fdc>   assign \&a[3] three
  32. fdc>
  33. fdc>   arraytest &a                    ; Call macro with array name.
  34.  
  35. Thanks Frank.  For the programming objective which
  36. instigated the enquiry I found a nice solution based on
  37. redefinition of a macro within a macro.  With any luck you
  38. will be able to examine it soon.  Your instructions about
  39. array syntax are recorded for future reference.
  40.  
  41. Perhaps a brief discussion and comparison of syntax of
  42. formal languages can be tolerated here.  This is for
  43. interest and is not a criticism of Kermit.
  44.  
  45. I also program in J (http://www.jsoftware.com/ and
  46. ftp://archive.uwaterloo.ca/languages/j/Welcome.html) and
  47. can not help but compare the syntax.  These are the
  48. analogues in J of the Kermit operations you described.
  49.  
  50. The 3x3 identity matrix is placed in variable I thus.
  51.   I =. 3 3 $ 1 0 0 0
  52.  
  53. The value in I is copied to another variable v thus.
  54.   v =. I
  55.  
  56. If fn is a function which can take the value of I as an argument the
  57. evaluation is invoked by this.
  58.   fn I
  59. Alternatively, the name of the array, rather than the
  60. value it contains, is passed to fn this way.
  61.   fn 'I'
  62.  
  63. Neither the assignment of the value of I to v nor the
  64. evaluation of fn on I mention the components of I.
  65.  
  66. In <Jf10IGSklAzn@cc.usu.edu> posted at 2000 Feb 23 Joe
  67. Doupnik said,
  68. jd>     Just a comment from the trenches on this item.  The
  69. jd> fancier notation used by Frank is nifty.  However when it
  70. jd> comes to implementing it in assembler within a small space
  71. jd> for a DOS program and inside of especially complex code
  72. jd> for parsing, then things are sticky.  Thus I decided to
  73. jd> not implement the dot semicolon-equal etc material as
  74. jd> there are equivalent ways of accomplishing the goal.
  75. jd> Apologies for the inconvience of having two ways of doing
  76. jd> this.
  77.  
  78. Multiple syntaces--no problem.
  79.  
  80. I did not realize that MS-DOS Kermit is written in
  81. assembler.  Wow!  The J interpreter was written in C. The
  82. old J6 and possibly the J7 sources should still be
  83. available on the ftp server noted above.
  84.  
  85. In <891dnn$qol$1@newsmaster.cc.columbia.edu> posted at
  86. 2000 Feb 23 19:51:19 GMT Frank da Cruz said,
  87. fdc> ... MS-DOS Kermit is painstakingly constructed
  88. fdc> for the traditional memory-constrained environment ...
  89.  
  90. I have used J6 on a PC with DOS 5.0 and never encountered
  91. a limit.  One J application was much larger than my Kermit
  92. application.  J6 must use extended memory or something
  93. similar.
  94.  
  95. fdc>  http://www.columbia.edu/kermit/scriptref.html
  96.  
  97. Thanks.  I will study that.
  98.  
  99. In J, suppose A is a variable containing the number 30 and
  100. B is a variable containing the number 45.
  101.  
  102. fdc>  .variable = string
  103.  
  104. J doesn't have assignment-without-evaluation exactly; I
  105. suppose the closest idea is to assign the name of a
  106. variable to another variable.
  107.        variable =. 'A'
  108.  
  109. fdc>  .variable := string
  110.  
  111. J analogue ...
  112.        variable =. A
  113. Using the J function called Do the same result is obtained
  114. from ...
  115.        variable =. ". 'A'
  116.  
  117. ". evaluates the argument it receives.
  118.  
  119. fdc>  .variable ::= string
  120.  
  121. J analogues ...
  122.        variable =. A + B
  123.        variable =. ". 'A + B'
  124. Results of evaluation of strings can be combined with
  125. ordinary evaluation.
  126.        variable =. 90 + ". 'A + B'
  127.  
  128. I draw these conclusions.
  129.  
  130. 1.  Some manipulations of an array, including transfer as
  131. argument, can be performed without reference to
  132. components.
  133.  
  134. 2.  The concepts of assignment and evaluation can be
  135. represented by specific notations, as with =.  and ".  in
  136. J, or by a single notation, as with ::= in Kermit.
  137.  
  138. Well, I hope this is more interesting than pedantic!
  139.  
  140. fdc> ...  The script reference mentioned above shows you
  141. which features you can use in which versions of each
  142. program.
  143.  
  144. Thanks.  I am aiming to make the scripts as interpreter
  145. non-specific as possible.
  146.  
  147. Regards,     Peter_Easthope@gulfnet.pinc.com
  148.  
  149.  
  150. Sent via Deja.com http://www.deja.com/
  151. Before you buy.